{
  LW Laytool -- Layout Interactive Tools

  Layout tool plug-ins are just custom Layout tools.
  To the user, they behave like Layout's built-in tools
  (the tools activated by the Move, Rotate and Scale buttons, for example).

  Based on lwlaytool.h which is:
  Copyright 2001, NewTek, Inc.
}

{
  Copyright 2012, Jameel Halabi

  This unit is part of the BlaiseWave wrapper,
  which is licensed under the BSD 2-Clause license (see licenses/license.txt).
}

unit LW_Laytool;

{$mode objfpc}{$H+}

interface

uses
  LW_Types   ,
  LW_Tool    ,
  LW_CustObj ,
  LW_XPanel  ;

const
  LWLAYOUTTOOL_CLASS 	= 'LayoutTool' ;
  LWLAYOUTTOOL_VERSION	= 1 ;


type
  { A Layout tool is a LightWave viewport tool whose draw() function
    takes a LWCustomObjAccess instead of a LWWireDrawAccess structure.
    It has the following handler functions.

    done    destroy the instance when the user discards the tool.

    draw    display a wireframe representation of the tool in a 3D
	    viewport.  Typically this draws the handles.

    help    return a text string to be displayed as a help tip for
	    this tool.

    dirty   return flag bit if either the wireframe or help string
	    need to be refreshed.

    count   return the number of handles.  If zero, then 'start' is
	    used to set the initial handle point.

    handle  return the 3D location and priority of handle 'i', or zero
	    if the handle is currently invalid.

    start   take an initial mouse-down position and return the index
	    of the handle that should be dragged.

    adjust  drag the given handle to a new location and return the
	    index of the handle that should continue being dragged
	    (often the same as the input).

    down    process a mouse-down event.  If this function returns
	    false, handle processing will be done instead of raw
	    mouse event processing.

    move    process a mouse-move event.  This is only called if the
	    down function returned true.

    up	    process a mouse-up event.  This is only called if the down
	    function returned true.

    event   process a general event: DROP, RESET or ACTIVATE

    panel   create and return a view-type xPanel for the tool instance.
 }
 PLWLayoutToolFuncs = ^TLWLayoutToolFuncs;
 TLWLayoutToolFuncs = record
   Done   : procedure
            (       Instance : PLWInstance             ) ;
   Draw   : procedure
            (       Instance : PLWInstance             ;
                    CustobjAccess : PLWCustomObjAccess );
   Help   : function
            (      Instance  : PLWInstance  ;
                   ToolEvent : PLWToolEvent ) : PChar   ; // const
   Dirty  : function
            (      Instance  : PLWInstance  ) : Integer ;
   Count  : function
            (      Instance  : PLWInstance  ;
                   ToolEvent : PLWToolEvent ) : Integer ;
   Handle : function
            (      Instance  : PLWInstance  ;
                   ToolEvent : PLWToolEvent ;
                   Handle    : Integer      ;
                   Pos       : TLWDVector   ) : Integer ;
   Start  : function
            (      Instance  : PLWInstance  ;
                   ToolEvent : PLWToolEvent ) : Integer ;
   Adjust : function
            (      Instance  : PLWInstance  ;
                   ToolEvent : PLWToolEvent ;
                   Handle    : Integer      ) : Integer ;
   Down   : function
            (      Instance  : PLWInstance  ;
                   ToolEvent : PLWToolEvent ) : Integer ;
   Move   : procedure
            (      Instance  : PLWInstance  ;
                   ToolEvent : PLWToolEvent ) ;
   Up     : procedure
            (      Instance  : PLWInstance  ;
                   ToolEvent : PLWToolEvent ) ;
   Event  : procedure
            (      Instance  : PLWInstance  ;
                   Code      : Integer      ) ;
   panel  : function
            (      Instance  : PLWInstance  ) : PLWXPanel ;
 end;

 PLWLayoutTool = ^TLWLayoutTool;
 TLWLayoutTool = record
   Instance : PLWInstance ;
   Tool     : PLWLayoutToolFuncs;
 end;

implementation

end.

